Repository navigation
stm32: do not declare ADC interrupts unless using SIMPLEFOC_STM32_ADC_INTERRUPT - #546
Moddingear wants to merge 1 commit into
Conversation
|
Looks good. I usually use DMA for the ADC results, but have used interrupts as well, and had to hunt down that function in the library code and disable it. Better to control it with a #define so you don't have to modify the library code. |
bb0b10a to
141a1ed
Compare
|
Hey @Moddingear , This will not work in oour case. When the timer does not have interrupt counter we use interrupt callback to downsample the readings. The proposed PR woudl break the readings on timers without repetition counter. So we might add a new flag somewhere called And condition the ADC handlers on this maybe. If this flag is not defined then the interrupts are not allowed and you can condition the adc handler definitions on this. |
141a1ed to
f3d64ae
Compare
|
Modified as requested. |
|
Thanks for updating the pr and going forward with this. Basically we do need the old flag and it did what we need it to do. If the flag is not defined that is where the nuance happens.
The new flag (SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK) should not just be the inverse of the old flag, but disable the behaviour in the case 2. So what I would like you to do, if we want this PR to work is to modify the lines of family files to return error if there is no repetition counter and the interrupt is disabled: if(tim_interrupt) {
// error in the timer interrupt initialization
SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used");
#ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK
SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!");
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
#endif
} |
…nterrupt handling by simplefoc
f3d64ae to
cb1f4fb
Compare
|
@askuric Something like that ? The handlers are registered only if |
Removing the definition of interrupt handlers if no interrupts used